﻿using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace Multivee.UI
{
    internal class ShapeGraphPictureBox: PictureBox
    {
        private readonly Brush _glyphBrush = new SolidBrush(Color.Black);
        private readonly Pen _glyphPen = new Pen(Color.GhostWhite);
        private readonly Size _glyphSize = new Size(3, 3);
        private List<Point> _glyphs = new List<Point>(12);

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);

            foreach (Point glyphPoint in _glyphs)
            {
                Rectangle rect = new Rectangle(glyphPoint, _glyphSize);
                pe.Graphics.FillRectangle(_glyphBrush, rect);
                pe.Graphics.DrawRectangle(_glyphPen, rect);
            }
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            _glyphs.Add(e.Location);
            Invalidate();
        }
    }
}
